package com.zyd.blog.personal.service.impl;

import com.zyd.blog.personal.enuminterface.IsDelete;
import com.zyd.blog.personal.enuminterface.Status;
import com.zyd.blog.personal.enuminterface.UserStatus;
import com.zyd.blog.persistence.mapper.UserFansMapper;
import com.zyd.blog.personal.service.UserFansService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 用户粉丝信息业务逻辑层
 * @author mfy
 */
@Service
public class UserFansServiceImpl implements UserFansService {

    @Resource
    private UserFansMapper userFansMapper;

    @Override
    public List<Map<String,Object>> getUserFansInfo(Long userId){
        //  3. 查询用户粉丝
        Map<String,Object> condition = new HashMap<>(16);
        // 用户自身是否存在
        condition.put("focusIsDelete", IsDelete.IS_DELETE_NO);
        // 用户自身状态是否正常
        condition.put("focusStatus", UserStatus.USER_STATUS_DEFAULT);
        // 是否关注
        condition.put("isFocus", Status.STATUS_YES);
        // 查询条件
        condition.put("focusId",userId);
        return userFansMapper.queryUserFansByCondition(condition);
    }

}
